
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.junit.jupiter.api.Test;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;


import java.io.IOException;
import java.sql.*;

import static cn.hutool.Hutool.*;
@RestController
public class Playground {


    @Test
    public void hutool() {
        printAllUtils();
    }



    @Test
    public void webSearch() throws IOException {
        String query = "星座占卜";

            // 构造搜索 URL
            String url = "https://html.duckduckgo.com/html/?q=" + java.net.URLEncoder.encode(query, "UTF-8");
            System.out.println(url);
            // 使用 Jsoup 抓取页面（DuckDuckGo 的 HTML 版搜索页面）
            Document doc = Jsoup.connect("https://html.duckduckgo.com/html").get();
            Object obj = new Object();
            Object obj2 = obj;
            obj.equals(obj2);
            System.out.println(doc.text());
    }
    @Test
    public void testDatabaseConnection() {
        String url = "jdbc:postgresql://内网服务器IP:5432/emotional_support";
        String username = "root";
        String password = "220110605";

        try (Connection conn = DriverManager.getConnection(url, username, password)) {
            System.out.println("数据库连接成功！");

            // 测试vector扩展
            Statement stmt = conn.createStatement();
            ResultSet rs = stmt.executeQuery("SELECT * FROM pg_extension WHERE extname = 'vector'");
            if (rs.next()) {
                System.out.println("pgvector扩展已安装");
            }
        } catch (SQLException e) {
            System.err.println("连接失败: " + e.getMessage());
        }
    }

}

